using System;
using System.Data;

namespace SLIITPro.Data.Entity
{
    public class Users
    {
        private int _userId;
        private string _firstName;
        private string _lastName;
        private string _street;
        private string _city;
        private string _province;
        private string _country;
        private string _email;
        private string _password;
        private string _userKey = string.Empty;
        private string _activationCode;
        private bool _isActivated;
        private DateTime _createdAt;
        private DateTime _updatedAt;
        private string _userType;
        private string _phone;
        private string _fax;

        public int UserId { get { return _userId; } set { _userId = value; } }
        public string FirstName { get { return _firstName; } set { _firstName = value; } }
        public string LastName { get { return _lastName; } set { _lastName = value; } }
        public string Street { get { return _street; } set { _street = value; } }
        public string City { get { return _city; } set { _city = value; } }
        public string Province { get { return _province; } set { _province = value; } }
        public string Country { get { return _country; } set { _country = value; } }
        public string Email { get { return _email; } set { _email = value; } }
        public string Password { get { return _password; } set { _password = value; } }
        public string UserKey { get { return _userKey; } set { _userKey = value; } }
        public string ActivationCode { get { return _activationCode; } set { _activationCode = value; } }
        public bool IsActivated { get { return _isActivated; } set { _isActivated = value; } }
        public DateTime CreatedAt { get { return _createdAt; } set { _createdAt = value; } }
        public DateTime UpdatedAt { get { return _updatedAt; } set { _updatedAt = value; } }
        public string UserType { get { return _userType; } set { _userType = value; } }
        public string Phone { get { return _phone; } set { _phone = value; } }
        public string Fax { get { return _fax; } set { _fax = value; } }

        public Users() { }

        public Users(DataRow row)
        {
            if (row["UserId"] != DBNull.Value) UserId = Int16.Parse(row["UserId"].ToString());
            if (row["FirstName"] != DBNull.Value) FirstName = row["FirstName"].ToString();
            if (row["LastName"] != DBNull.Value) LastName = row["LastName"].ToString();
            if (row["Street"] != null) Street = row["Street"].ToString();
            if (row["City"] != DBNull.Value) City = row["City"].ToString();
            if (row["Province"] != DBNull.Value) Province = row["Province"].ToString();
            if (row["Country"] != DBNull.Value) Country = row["Country"].ToString();
            if (row["Email"] != DBNull.Value) Email = row["Email"].ToString();
            if (row["Password"] != DBNull.Value) Password = row["Password"].ToString();
            if (row["UserKey"] != DBNull.Value) UserKey = row["UserKey"].ToString();
            if (row["ActivationCode"] != DBNull.Value) ActivationCode = row["ActivationCode"].ToString();
            if (row["IsActivated"] != DBNull.Value) IsActivated = Convert.ToBoolean(row["IsActivated"]);
            if (row["CreatedAt"] != DBNull.Value) CreatedAt = DateTime.Parse(row["CreatedAt"].ToString());
            if (row["UpdatedAt"] != DBNull.Value) UpdatedAt = DateTime.Parse(row["UpdatedAt"].ToString());
            if (row["UserType"] != DBNull.Value) UserType = row["UserType"].ToString();
            if (row["Phone"] != DBNull.Value) Phone = row["Phone"].ToString();
            if (row["Fax"] != DBNull.Value) Fax = row["Fax"].ToString();
        }

    }
}